<template>
  <div class="main">
    <!-- 全局加载动画 -->
    <div v-show="loading">
      <Loading />
    </div>
    <!-- 手机端显示顶部控制菜单触发器 -->
    <div v-if="isMobile">
      <common-wap-top-bar />
      <common-wap-main-nav />
      <common-countdown />
    </div>
    <div v-else>
      <div :class="{ floatBox: isHome }">
        <common-main-top />
        <common-main-nav />
      </div>
    </div>
    <div @click.stop="hideSearchBox">
      <Nuxt class="body" />
    </div>
    <common-foot />
    <common-float-right />
    <!-- 左侧浮动涉交 -->
    <common-float-left v-if="!isMobile"/>
    <!-- 隐私政策 -->
    <!-- <common-privacy></common-privacy> -->
    <!-- 防疫弹框 -->
    <common-modal v-if="showModalOut === '1'" />
  </div>
</template>

<script>
import { getConfigs } from "@/api/common";
import util from "@/libs/util.js";
const MenuKey = "Menu";
const Expires = 1000 * 60 * 2;

export default {
  head() {
    return {
      title: this.$store.state.seo.title || "PCHi",
      meta: [
        {
          hid: "description",
          name: "description",
          content: this.$store.state.seo.description || "PCHi",
        },
        {
          hid: "keywords",
          name: "keywords",
          content: this.$store.state.seo.keywords || "PCHi",
        },
      ],
      script: [
        {
          src: "/cmsApi/javaScript/view/baidu.js",
        },
      ],
    };
  },
  computed: {
    loading() {
      return this.$store.state.app.loading;
    },
  },
  data() {
    return {
      showModalOut: "", //弹框外部控制器
    };
  },
  beforeMount() {
    this.$store.commit("setLoading", true);
  },
  mounted() {
    if (process.browser) {
      new WOW({
        live: false,
        offset: 200,
        mobile: true, // 是否在移动设备上执行动画
        animateClass: "animate__animated",
      }).init();
    }
    this.$store.commit("setLoading", false);
    this.getConfigsFun();
	if(this.isMobile){
		this.wxShare();	
	}
	
  },
  methods: {
    getConfigsFun() {
      this.invoke(getConfigs, "modal_show").then((res) => {
        if (res && res.code == 200) {
          if (res.data) {
            const configData = res.data;
            this.showModalOut = configData.modal_show;
          }
        }
      });
    },
  },
};
</script>

<style lang="scss">
.main {
  .body {
    min-height: 60vh;
  }
}
</style>
